<template>
  <div>
    <router-link v-for="(item, index) in list" :key="index" :to="`/studentCheckDetail?name=${item.name}&id=${item.id}`">
      <div class="item" v-if="item.id">
        <div class="avatar"><img :src="item.head_sculpture ? item.headimgurl : avatar" alt="" width="100%"></div>
        <div class="name">{{ item.name }}签到记录</div>
      </div>
    </router-link>
  </div>
</template>

<script>
import api from '@/api'
export default {
  name: 'check-student-list',
  data () {
    return {
      avatar: require('@/assets/img/icon-avatar.png'),
      list: []
    }
  },
  methods: {
    getStudent () {
      let params = {teacher_id: JSON.parse(sessionStorage.getItem('user')).id}
      api.teacherVIPList({
        params,
        callback: res => {
          if (res.data.error_code === 0) {
            this.list = res.data.data
          }
        }
      })
    }
  },
  created () {
    this.getStudent()
  }
}
</script>

<style scoped>
  .item{
    display: flex;
    align-items: center;
    height: 60px;
    padding-left: 15px;
  }
  .item .avatar{
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
    flex-grow: 0;
    flex-shrink: 0;
    margin-right: 20px;
  }
  .item .name{
    flex-shrink: 1;
    flex-grow: 1;
    font-size:16px;
    font-family:PingFang SC;
    font-weight:bold;
    color:rgba(26,29,32,1);
    height: 60px;
    line-height: 60px;
    border-bottom: 1px solid rgba(0,0,0,.3);
  }
</style>
